<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="java.util.*" %>
<%@ page import="com.edu.entity.*" %>
<%@ page import="com.edu.service.*" %>
<%@ page import="com.edu.service.Impl.*" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
	<link rel="stylesheet" href="css/index.css">
</head>
<body>
	<header class="header">
		<div>
			<p><img src="images/xt.jpg" alt="">系统首页</p>
			<ul>
				<li>
					<a href="#" onclick="javascript:show1()">
						<img src="images/gr.jpg" alt="">个人中心<img src="images/xl.jpg" alt="">
					</a>
				</li>
				<li name='zq1'>
					<a href="individual.jsp">个人</a>
				</li>
			</ul>
			<ul>
				<li>
					<a href="#" onclick="javascript:show2()">
						<img src="images/js.jpg" alt="">驾驶员管理<img src="images/xl.jpg" alt="">
					</a>
				</li>
				<li name='zq2'>
					<a href="Driver.jsp">驾驶员</a>
				</li>
			</ul>
			<ul>
				<li>
					<a href="#" onclick="javascript:show3()">
						<img src="images/xx.jpg" alt="">车辆信息管理<img src="images/xl.jpg" alt="">
					</a>
				</li>
				<li name='zq3'>
					<a href="Trucks.jsp">车辆信息</a>
				</li>
			</ul>
			<ul>
				<li>
					<a href="#" onclick="javascript:show4()">
						<img src="images/jd.jpg" alt="">借调车俩管理<img src="images/xl.jpg" alt="">
					</a>
				</li>
				<li name='zq4'>
					<a href="Tcheck.jsp">借调车俩</a>
				</li>
			</ul>
			<ul>
				<li>
					<a href="#" onclick="javascript:show5()">
						<img src="images/jd.jpg" alt="">车俩调度管理<img src="images/xl.jpg" alt="">
					</a>
				</li>
				<li name='zq5'>
					<a href="Dispatch.jsp">车俩调度</a>
				</li>
			</ul>
			<ul>
				<li>
					<a href="#" onclick="javascript:show6()">
						<img src="images/cl.jpg" alt="">车俩运营管理<img src="images/xl.jpg" alt="">
					</a>
				</li>
				<li name='zq6'>
					<a href="Trun.jsp">车俩花销</a>
				</li>
			</ul>
			<ul>
				<li>
					<a href="#" onclick="javascript:show7()">
						<img src="images/js.jpg" alt="">驾驶员运营管理<img src="images/xl.jpg" alt="">
					</a>
				</li>
				<li name='zq7'>
					<a href="Drun.jsp">驾驶员花销</a>
				</li>
			</ul>
		</div>
	</header>
	<footer class="footer">
		<div class="sm">
			<h3>货车调度管理系统</h3>
		</div>
		<ul>
			<li>
				管理员:&nbsp;&nbsp;${user.username }
			</li>
			<li>
				<a href="page.jsp">退出登录</a>
			</li>
		</ul>
	</footer>
	<section class="section">
		<form id="drunForm" action="DrunDeleteServlet" method="post"> 
		   <div>
	  			<p>系统首页&nbsp;>&nbsp;驾驶员运营管理</p>
		  		<div id="xs">
					序&nbsp;号
					<input class="form-input" type="text" name="DrunId" id="DrunId">&nbsp;
					驾驶员&nbsp;工号
					<input class="form-input" type="text" name="dJob" id="dJob">&nbsp;
					驾驶员&nbsp;姓名
					<input class="form-input" type="text" name="dName" id="dName">&nbsp;
					<br><br>
					驾驶员&nbsp;工资
					<input class="form-input" type="text" name="dCost" id="dCost">&nbsp;
					<br><br>
					<br><br>
		    		<input class="form-input2" type="button" onclick="changeAction('DrunServletAll?menu=1')"  value="查询">&nbsp;&nbsp;
					<input class="form-input2" type="button" onclick="changeAction('DrunServletAll?menu=3')" value="添加">&nbsp;&nbsp;
					<input class="form-input2" type="button" onclick="changeAction('DrunServletAll?menu=4')" value="删除">&nbsp;&nbsp;
					<input class="form-input2" type="button" onclick="changeAction('DrunServletAll?menu=2')" value="修改">&nbsp;&nbsp;
					<input class="form-input2" type="reset" >
				</div>
			</div>
		    <table>
	  			<tr>
	  				<td><input type="checkbox" ></td>
	  				<td>索引</td>
	  				<td>驾驶员工号</td>
	  				<td>驾驶员姓名</td>
	  				<td>驾驶员工资</td>
	  				<td>操作</td>
	  			</tr>
	  			<%	
	  			
	  				Object obj = request.getAttribute("list");
	  				List<Drun> list = new ArrayList<Drun>(); 
	  				if(obj != null){
	  					list = (List<Drun>)obj;
	  				}else{
	  					DrunService drunServlet = new DrunServiceImpl();
		  				list = drunServlet.showDrunList();
	  				}
	  				for(int i=0; i<list.size(); i++){
	  					Drun drun = list.get(i);
	  				
	  			%>
	  			<tr>
	  				<td><input type="checkbox" name="selectdid" value="<%=drun.getDrunId() %>"/></td>
	  				<td><%=drun.getDrunId() %></td>
	  				<td><%=drun.getdJob() %></td>
	  				<td><%=drun.getdName() %></td>
	  				<td><%=drun.getdCost() %></td>
	  				<td>
		  				<input type="button" value="删除" onclick="mysubmit(<%=drun.getDrunId() %>)"/>
		  				<input type="button" onclick="show('<%=drun.getDrunId() %>','<%=drun.getdJob() %>','<%=drun.getdName() %>','<%=drun.getdCost() %>')" value="查看"/>
		  			</td>
	  			</tr>
	  			<%
	  				}
	  			%>
	  		</table> 
	  		<input id="uid" type="hidden" value="" name="uid"/>
	  	</form>
	</section>
</body>
<script>
	function show1(){
		var obj=document.getElementsByName('zq1');
		for(var i=0;i<obj.length;i++){
			var a=obj[i].style.display;
			if(a == 'block'){
				obj[i].style.display='none';
			}else{
				obj[i].style.display='block';
			}
		}
	}
	
	function show2(){
		var obj=document.getElementsByName('zq2');
		for(var i=0;i<obj.length;i++){
			var a=obj[i].style.display;
			if(a == 'block'){
				obj[i].style.display='none';
			}else{
				obj[i].style.display='block';
			}
		}
	}
	
	function show3(){
		var obj=document.getElementsByName('zq3');
		for(var i=0;i<obj.length;i++){
			var a=obj[i].style.display;
			if(a == 'block'){
				obj[i].style.display='none';
			}else{
				obj[i].style.display='block';
			}
		}
	}
	
	function show4(){
		var obj=document.getElementsByName('zq4');
		for(var i=0;i<obj.length;i++){
			var a=obj[i].style.display;
			if(a == 'block'){
				obj[i].style.display='none';
			}else{
				obj[i].style.display='block';
			}
		}
	}
	
	function show5(){
		var obj=document.getElementsByName('zq5');
		for(var i=0;i<obj.length;i++){
			var a=obj[i].style.display;
			if(a == 'block'){
				obj[i].style.display='none';
			}else{
				obj[i].style.display='block';
			}
		}
	}
	
	function show6(){
		var obj=document.getElementsByName('zq6');
		for(var i=0;i<obj.length;i++){
			var a=obj[i].style.display;
			if(a == 'block'){
				obj[i].style.display='none';
			}else{
				obj[i].style.display='block';
			}
		}
	}
	
	function show7(){
		var obj=document.getElementsByName('zq7');
		for(var i=0;i<obj.length;i++){
			var a=obj[i].style.display;
			if(a == 'block'){
				obj[i].style.display='none';
			}else{
				obj[i].style.display='block';
			}
		}
	}
	
	function $(id){
  		return document.getElementById(id);
  	}
  	
	function mysubmit(uid) {
		$("uid").value=uid;
		var result = confirm("确认删除，删除后将无法修改");
		if (result) {
			$("drunForm").submit();
		}
	}
  	
	function changeAction(url){
  		$("drunForm").action=url;
  		$("drunForm").submit();
  	}
  	
  	function show(a,b,c,d){
  		$("DrunId").value=a;
  		$("dJob").value=b;
  		$("dName").value=c;
  		$("dCost").value=d;
  	}
</script>
</html>